﻿@model Layui.Entities.SysRole
@{
    ViewData["Title"] = "编辑角色";
}
<div class="col-sm-12">
    <div class="space-10"></div>
    <form asp-route="editRole" id="formEditRole" method="post" onsubmit="return false;" class="form-horizontal">
        @Html.HiddenFor(m => m.Id)
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right">@Html.RequiredSpan()角色名称</label>
            <div class="col-sm-5">
                <input type="text" asp-for="Name" placeholder="请输入就是名称" />
                <span asp-validation-for="Name" class="inline text-danger "></span>
            </div>
        </div>
        <div class="col-md-offset-3">
            <button class="btn btn-info btn-sm" type="submit">
                <i class="ace-icon fa fa-check bigger-110"></i>
                提交
            </button>
        </div>
    </form>
</div>
<script>
    $(function () {
        $.validator.unobtrusive.parse($('#formEditRole'));
        $('#formEditRole').submit(function (e) {
            if ($(this).valid()) {
                layer.load(2);
                $(this).ajaxSubmit(function (data) {
                    if (data.Status) {
                        location.reload();
                    } else {
                        layer.msg(data.Message, { icon: 2 });
                    }
                });
            }
        });
    });
</script>